#ifndef RSUCTRL_SHINE_G60E_H
#define RSUCTRL_SHINE_G60E_H

#include <QObject>
#include <QTimer>
#include "basersuctrl.h"


class RsuCtrlForShineG60E : public BaseRsuCtrl
{
    Q_OBJECT

public:
    explicit RsuCtrlForShineG60E(int id, QObject *parent = 0)
    {
        new (this) RsuCtrlForShineG60E(parent);
        this->setId(id);
    }

    explicit RsuCtrlForShineG60E(QObject *parent = 0);
    ~RsuCtrlForShineG60E();

public:
    virtual void reopenRsu();

    virtual void closeRsu();

public:
    virtual int initRsu();

    virtual void mockRawFrameData(QByteArray &frame)
    {
        m_rsuComm.mockRawFrameData(frame);
    }

protected:
    void processRsuInitFrame(quint8 nFrameIndex, const QByteArray &frame);
    void processObuInitFrame(const QByteArray &frame);
    void expectResult(int nFrameType);

protected:
    RsuCommForShineG60E m_rsuComm;
    int m_nExpectedFrameType;
    QTimer *m_pNoResponseTimer;
    QTimer *m_pHeartBeatTimer;

protected slots:
    void socketStateChanged(QAbstractSocket::SocketState socketState);
    void processRsuFrame(quint8 nFrameIndex, quint8 nFrameType, const QByteArray &frame);
    void handleNoResponseError();
    void handleHeartBeatTimeout();
};

#endif // RSUCTRL_SHINE_G60E_H
